<html>  
  <head>  
        <meta charset="utf-8">  
        <title>6.1.3 插值</title>  
  </head> 
  <style>

  </style>
<body>

<script src="../../d3/d3.min.js" charset="utf-8"></script> 
<script>  


var a = d3.rgb(255,0,0);	//红色
var b = d3.rgb(0,255,0);	//绿色

var compute = d3.interpolate(a,b);

console.log( compute(0) );		//输出#ff0000
console.log( compute(0.2) );	//输出#cc3300
console.log( compute(0.5) );	//输出#808000
console.log( compute(1) );		//输出#00ff00

console.log( compute(2) );		//输出#00ff00
console.log( compute(-1) );		//输出#ff0000

</script> 

</body>
</html>